package router

import (
	"github.com/gin-gonic/gin"
	"store/app/middleware"
	"store/global"
)

func AppRouter(r *gin.Engine) {
	//设置上传文件夹
	r.Static("upload", global.Config.App.UploadDir)

	r.GET(
		"/ping", func(c *gin.Context) {
			c.JSON(
				200, gin.H{
					"message": "pong",
				},
			)
		},
	)

	route := r.Group("api")
	routeNeedJwt := r.Group("api", middleware.JWTCheck())

	AdminRouter(route, routeNeedJwt)
}
